home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Sample for IP Resolver"
- ClientHeight = 3960
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 3960
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin VB.Frame Frame2
- Caption = "Forward lookup"
- Height = 1575
- Left = 120
- TabIndex = 6
- Top = 120
- Width = 4455
- Begin VB.CommandButton Command3
- Caption = "Resolve the Hostname"
- Height = 375
- Left = 2520
- TabIndex = 9
- Top = 1080
- Width = 1815
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 120
- TabIndex = 8
- Top = 600
- Width = 1695
- End
- Begin VB.TextBox Text1
- BackColor = &H8000000F&
- Height = 285
- Left = 2040
- TabIndex = 7
- Top = 600
- Width = 2295
- End
- Begin VB.Label Label2
- Caption = "Host name:"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 360
- Width = 1695
- End
- End
- Begin VB.Frame Frame1
- Caption = "Reverse lookup"
- Height = 1575
- Left = 120
- TabIndex = 1
- Top = 1800
- Width = 4455
- Begin VB.CommandButton Command1
- Caption = "Resolve the IP"
- Height = 375
- Left = 2520
- TabIndex = 4
- Top = 1080
- Width = 1815
- End
- Begin VB.TextBox txtIP
- Height = 285
- Left = 120
- TabIndex = 3
- Top = 600
- Width = 1695
- End
- Begin VB.TextBox txtHost
- BackColor = &H8000000F&
- Height = 285
- Left = 2040
- TabIndex = 2
- Top = 600
- Width = 2295
- End
- Begin VB.Label Label1
- Caption = "IP Address"
- Height = 255
- Left = 120
- TabIndex = 5
- Top = 360
- Width = 1695
- End
- End
- Begin VB.CommandButton Command2
- Cancel = -1 'True
- Caption = "Close"
- Height = 375
- Left = 3600
- TabIndex = 0
- Top = 3480
- Width = 975
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- txtHost.Text = ""
- If Len(Trim(txtIP.Text)) <= 1 Then
- MsgBox "Please enter a valid IP in the IP address textbox."
- Exit Sub
- End If
- ' Create a new sockets name resolver object:
- Dim wsrResolver As New WSResolver
- ' Create a string (and allocate space)
- ' NOTE: This string MUST be long enough
- ' for the FQDN!
- Dim tempString As String * 200
- ' Call the method:
- wsrResolver.GetHostByAddr txtIP.Text, tempString
- ' Trim off the trailing nulls and print:
- Dim sRetVal As String
- sRetVal = Trim$(Left$(tempString, InStr(1, tempString, Chr(0))))
- txtHost.Text = sRetVal
- ' Call 'release' on the COM object:
- Set wsrResolver = Nothing
- End Sub
- Private Sub Command2_Click()
- End
- End Sub
- Private Sub Command3_Click()
- Text1.Text = ""
- If Len(Trim(Text2.Text)) <= 1 Then
- MsgBox "Please enter a valid Hostname in the Hostname textbox."
- Exit Sub
- End If
- ' Create a new sockets name resolver object:
- Dim wsrResolver As New WSResolver
- ' Create a string (and allocate space)
- ' NOTE: This string MUST be long enough
- ' for the FQDN!
- Dim tempString As String * 200
- ' Call the method:
- wsrResolver.GetAddrByHost Text2.Text, tempString
- ' Trim off the trailing nulls and print:
- Dim sRetVal As String
- sRetVal = Trim$(Left$(tempString, InStr(1, tempString, Chr(0))))
- Text1.Text = sRetVal
- ' Call 'release' on the COM object:
- Set wsrResolver = Nothing
- End Sub
-